import allure

from base.base_page import BasePage
from locator.search_page_loc import *


class SearchPage(BasePage):
    @allure.step("获取搜索结果列表所有书籍")
    def get_search_book_name_result(self):
        elements = self.locator_elements_with_wait(all_books_name_loc)
        booknames = [element.text for element in elements]
        return booknames

    @allure.step("获取搜索结果列表所有作者名字")
    def get_search_author_name_result(self):
        elements = self.locator_elements_with_wait(all_author_name_loc)
        author_names = [element.text.split("：")[1] for element in elements]
        return author_names